FROM node:lts-alpine

RUN npm config set registry https://registry.npmmirror.com
RUN npm i -g pm2
RUN pm2 install pm2-logrotate

RUN pm2 set pm2-logrotate:max_size 100G && \
    pm2 set pm2-logrotate:retain 365 && \
    pm2 set pm2-logrotate:dateFormat YYYY-MM-DD

EXPOSE 3000

VOLUME /var/www
WORKDIR /var/www

CMD ["npm", "run", "start"]
